﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
public partial class administrator_uc_admin_banner : System.Web.UI.UserControl
{    
    protected void Page_Load(object sender, EventArgs e)
    {
        string CurrentUser = SecurityServices.GetCurrentUserName();
        if (!string.IsNullOrEmpty(CurrentUser))
        {
            ltUserMember.Text = LoadMemberInfo(SecurityServices.GetCurrentUserName());
        }
    }
    private string LoadMemberInfo(string UserName)
    {
        StringBuilder Html = new StringBuilder();
        Html.Append(
            "<a href=\"javascript:void(0);\" title=\"My Profile\" class=\"menu_class\" style=\"color: #FF6600; font-style: italic\">" + UserName + "  <img src=\"../images/icons/icon_down.jpg\" border=\"0px\" /></a> " +
            "<ul class=\"the_menu\"> "+
            "	<li><a href=\"javascript:EditItem('e_user','EditItem','" + new CmsBLL().Manager_GetIDByUserName(UserName) + "','600','300');\">Thông tin tài khoản</a></li> " +
            "	<li><a href=\"javascript:EditItem('e_changepass','EditItem','" + new CmsBLL().Manager_GetIDByUserName(UserName)+ "','490','160');\">Đổi mật khẩu</a></li> " +         
            "</ul> "
            );
        return Html.ToString();
    }
    protected void lbtLogout_Click(object sender, EventArgs e)
    {       
        Session.Abandon();
        HttpCookie cookie = Request.Cookies.Get("dlploginCookie");
        // do not use Remove method to remove cookie. also Do not use DateTime.MinValue, they do not work
        if (cookie != null)
        {
            cookie.Expires = DateTime.Now.AddMonths(-2);
            Response.Cookies.Add(cookie);
        }
        Response.Redirect("login.aspx");
    }
}